N,M,K = list(map(int,input().split()))
num = input()  #此时num为字符串类型


end = 1*10**N
start = end//10

print(start, end)


cnt = 0
numList = []
for i in range(start,end):
  num1 = str(i)
  if num not in num1:
    numList.append(num1)
    cnt+=1

print(cnt%K)
print(numList[-1], numList[0],len(numList))

